<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <select name="" id="sheng">
        <option value="">省</option>
        <option value="1">四川</option>
        <option value="2">广东</option>
        <option value="3">云南</option>
    </select>
    <select name="" id="shi">
        <option value="">--</option>
        <!-- <option value="">成都</option>
        <option value="">眉山</option>
        <option value="">绵阳</option> -->
    </select>
    <script>
        var shichuan=['成都','眉山','绵阳','德阳','巴中','广元']
        var guangdong=['东莞','深圳','湛江']
        var yunnan=['丽江','泸沽湖','大丽']

        var sheng=document.getElementById('sheng')
        var shi=document.getElementById('shi')
        
        sheng.onchange=function(){
            console.log(this.value)//接管了选择的option的value
            var str=''
            if(this.value==1){
                for(var i=0;i<shichuan.length;i++){
                    str=str+`<option>${shichuan[i]}</option>`
                }
                shi.innerHTML=str
            }else if(this.value==2){
                for(var i=0;i<guangdong.length;i++){
                    str=str+`<option>${guangdong[i]}</option>`
                }
                shi.innerHTML=str
            }else if(this.value==3){
                for(var i=0;i<yunnan.length;i++){
                    str=str+`<option>${yunnan[i]}</option>`
                }
                shi.innerHTML=str
            }
        }
    </script>
</body>
</html>